import request from "@/utils/request";
export const getArticlelist = (data) => {
  return request({
    method: "GET",
    url: "/users",
    params: data,
  });
};

export const getArticleswitch = (data) => {
  return request({
    method: "PUT",
    url: `/users/${data.id}/state/${data.mg_state}`,
    data,
  });
};
//添加用户
export const getArticledialog = (data) => {
  return request({
    method: "POST",
    url: "/users",
    data,
  });
};

//id获取用户信息
// /users/{id}
export const getArticlxiu = (data) => {
  return request({
    method: "GET",
    url: `/users/${data.id}`,
    data,
  });
};

//修改用户详情
///users/{id}
export const getArticlxiushow = (data) => {
  return request({
    method: "PUT",
    url: `/users/${data.id}`,
    data,
  });
};
//id已经传来了不需要点出来

///users/{id}
export const getArticlshan = (id) => {
  return request({
    method: "DELETE",
    url: `/users/${id.id}`,
    id,
  });
};

//获取角色列表
export const getroles = (data) => {
  return request({
    method: "GET",
    url: "/roles",
    params: data,
  });
};

//分配用户角色
// users/:id/role
export const fenusers = (id, data) => {
  return request({
    method: "PUT",
    url: `users/${id}/role`,
    data,
  });
};
